package pl.edu.agh.jemo.evolution.operator.mutation.impl;

import javax.swing.JPanel;

import pl.edu.agh.jemo.evolution.operator.mutation.Mutation;
import pl.edu.agh.jemo.evolution.specimen.Specimen;

/**
 * This mutation implementation doesn't affect given specimen. It has been added, to allow genetic algorithms without performing mutation.
 * It is recommended to use this class, rather then another mutation with chance set to 0.0, due to optimalization issues. Only this class guarantees, that no specimen will be mutated.
 * 
 * 
 * @author Marcin Zbijowski
 *
 */
public class EmptyMutation implements Mutation {

	/**
	 * Does nothing.
	 * Empty mutation should not modify given specimen in any way. It is used when mutation operator has been switched off.
	 */
	@Override
	public void performMutation(Specimen specimen) {
		// Empty mutation doesn't affect mutated specimen
	}

	/**
	 * Returns configuration panel being extension of JPanel instance.
	 * Returned panel is displayed by graphical user interface allowing user to confgiure mutation.
	 * This method may return null if no configuration for operator is possible.
	 * 
	 * @return Empty mutation doesn't require any configuration, so null pointer is returned by this method.
	 */
	@Override
	public JPanel getConfigPanel() {
		return null;
	}
	
	/**
	 * Returns String object containing description of mutation configuration in readable form as a summary.
	 * 
	 * @return String description of object configuration.
	 */
	@Override
	public String toString() {
		return "Mutation class: Empty mutation\n";
	}

}
